﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Configuration;

namespace ErrorLog
{
    internal class LogToFile : ILog
    {
        public void logNow(string strError)
        {
            string ErrorFile = ConfigurationSettings.AppSettings["ErrorFile"];

            lock (this)
            {
                // make sure only one process can get into this section (semaphore)
                StreamWriter sw = File.AppendText(ErrorFile);
                sw.WriteLine(strError);
                sw.Flush();
                sw.Close();
            }
        }
    }
}
